<template>
	<div>
		<admin-header></admin-header>
		<div class="bread" v-if="info">
			<el-breadcrumb separator="/">
				<el-breadcrumb-item :to="{ path: '/admin' }">所有分类</el-breadcrumb-item>
				<el-breadcrumb-item><a @click="jump2Category(info.category.id)">{{info.category.name}}</a></el-breadcrumb-item>
				<el-breadcrumb-item><a @click="jump2Product(info.category.id)">{{info.name}}</a></el-breadcrumb-item>
				<el-breadcrumb-item>编辑产品属性</el-breadcrumb-item>
			</el-breadcrumb>
		</div>
		<p-form></p-form>
	</div>
</template>

<script>
	import AdminHeader from '../header'
	import PForm from './components/product_property_form'
  import {getProduct} from '@/api/admin/product.js'
	export default{
		data() {
			return {
				info:null,
			}
		},
		components: {
			AdminHeader,
			PForm
		},
    methods: {
      getBread(){
        let data = {
          id:this.$route.query.productId
        }
        getProduct(data).then(res => {
          this.info = res.data
        })
      },
      jump2Category(id){
        this.$router.push('/admin/category?id='+id)
      },
      jump2Product(id){
        this.$router.push('/admin/product?id='+id)
      }
    },
    created() {
      this.getBread()
    }
	}
</script>

<style scoped>
	.bread{
		width: 90%;
		margin: 20px auto;
		background-color: #f5f5f5;
		height: 40px;
		padding: 0 10px;
		border-radius: 5px;
	}
	.bread>div{
		line-height: 40px;
	}
</style>
